/*
 * EditTaskViewEditTag.java
 *
 * Created on 13 de Dezembro de 2007, 23:54
 */

package madsgtdinterface;

import thunderbirdgtd.entities.Tag;



/**
 *
 * @author  rui
 */
public class EditTaskViewEditTag extends javax.swing.JPanel {
    private Tag myTag;
    private boolean toDelete=false;
    /** Creates new form EditTaskViewEditTag */
    public EditTaskViewEditTag() {
        initComponents();
    }
    public EditTaskViewEditTag(Tag myt){
        initComponents();
        myTag=myt;
        jTextField1.setText(myTag.getTagName());
        this.setVisible(true);
    }
    
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jTextField1 = new javax.swing.JTextField();
        jToggleButton1 = new javax.swing.JToggleButton();

        jTextField1.setText("jTextField1");

        jToggleButton1.setText("Apagar?");
        jToggleButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jToggleButton1ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jToggleButton1)
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addComponent(jToggleButton1))
        );
    }// </editor-fold>//GEN-END:initComponents

    private void jToggleButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jToggleButton1ActionPerformed
      
      if(getStatus())
        jToggleButton1.setText("Delete?");
      else
        jToggleButton1.setText("To Delete");
        setDelete(!getStatus());
    }//GEN-LAST:event_jToggleButton1ActionPerformed
    
    
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JTextField jTextField1;
    private javax.swing.JToggleButton jToggleButton1;
    // End of variables declaration//GEN-END:variables

    public Tag getMyTag() {
        return myTag;
    }

    public void setMyTag(Tag myTag) {
        this.myTag = myTag;
    }

    public boolean getStatus() {
        return toDelete;
    }

    public void setDelete(boolean delete) {
        this.toDelete = delete;
    }
    
}
